import modalMixin from '@/mixins/modalMixin'

export default {
  mixins: [modalMixin],
  props: {
    resource: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      dataSource: [],
      columns: [
        {
          title: '序号',
          dataIndex: 'rowIndex',
          align: 'center',
          width: 45,
          customRender(text, record, index) {
            return index + 1
          }
        },
        {
          title: '资源编码',
          dataIndex: 'checkno',
          align: 'center',
          width: 120,
          scopedSlots: {
            customRender: 'checkno'
          }
        },
        {
          title: '资源名称',
          dataIndex: 'checkname',
          align: 'center',
        },
        {
          title: '点检部位',
          dataIndex: 'position',
          align: 'center',
          width: 120,
        },
        {
          title: '点检标准',
          dataIndex: 'standard',
          align: 'center',
          width: 120,
        },
        {
          title: '点检项目名称',
          dataIndex: 'checkProjectName',
          align: 'center',
          width: 120,
        },
        {
          title: '上限值',
          dataIndex: 'upValue',
          align: 'center',
          minWidth: 70,
        },
        {
          title: '下限值',
          dataIndex: 'belowValue',
          align: 'center',
          minWidth: 70,
        },
        {
          title: '点检方法',
          dataIndex: 'checkType',
          align: 'center',
          width: 70,
          customRender(text) {
            let type
            switch (text) {
              case '1':
                type = '计量'
                break
              case '2':
                type = '计数'
                break
            }

            return type
          }
        },
        {
          title: '点检结果',
          dataIndex: 'checkresult',
          align: 'center',
          width: 110,
          scopedSlots: {
            customRender: 'checkresult'
          }
        },
        {
          title: '结果判定',
          dataIndex: 'decide',
          align: 'center',
          width: 70,
          customRender(text) {
            let type
            switch (text) {
              case 1:
                type = '合格'
                break
              case 2:
                type = '不合格'
                break
            }

            return type
          }
        }
      ]
    }
  },
  methods: {
    getJudgeStatus(text) {
      let type
      switch (text) {
        case 1:
          type = 'PASS'
          break
        case 2:
          type = 'NG'
          break
      }

      return type
    },
  },
}